package org.lyy.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.lyy.entity.ProductInfo;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProductInfoDao {

    @Insert("insert into stock(productId,productName,productStock,productPrice,productStatus,productKind) values(#{productId},#{productName},#{productStock},#{productPrice},#{productStatus},#{productKind})")
    public void insertProduct(ProductInfo Product);

    @Select("select * from stock")
    public List<ProductInfo> queryAll();

    @Select("select * from stock where productId=#{productId}")
    public List<ProductInfo> findOne(String productId);

    @Update("update stock set productName=#{productName},productStock=#{productStock},productPrice=#{productPrice},productStatus=#{productStatus},productKind=#{productKind} where productId=#{productId} ")
    public int update(ProductInfo Product);

    @Delete("delete from stock where productId=#{productId}")
    public void delete(String productId);

    @Select("select * from stock where productStatus=#{productStatus}")
    public List<ProductInfo> selectStatus(String productStatus);

    @Select("select * from stock where productKind=#{productKind}")
    public List<ProductInfo> selectKind(String productKind);

}